home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig03_04.jar
/
Ch03
/
Fig03_04
/
Fig03_04.cpp
Wrap
C/C++ Source or Header
|
1997-10-11
|
664b
|
37 lines
// Fig. 3.4: fig03_04.cpp
// Finding the maximum of three integers
#include <iostream.h>
int maximum( int, int, int ); // function prototype
int main()
{
int a, b, c;
cout << "Enter three integers: ";
cin >> a >> b >> c;
// a, b and c below are arguments to
// the maximum function call
cout << "Maximum is: " << maximum( a, b, c ) << endl;
return 0;
}
// Function maximum definition
// x, y and z below are parameters to
// the maximum function definition
int maximum( int x, int y, int z )
{
int max = x;
if ( y > max )
max = y;
if ( z > max )
max = z;
return max;
}